<template>
    <div class="billChecked">
        <!--  -->
        <cardComponent :isLoadings="isLoadings" :pageTitle="`查询服务类-已出账单明细查询（ 账户类别： ${ITEMCM} ）`">
            <template slot="cardBody">
                <!-- 已出账单查询 -->
                <div v-show="showFlag">
                    <el-form :inline="true" label-position="right" size="small" label-width="100px">
                        <el-row>
                            <el-col :span="9" :offset="1">
                                <el-form-item label="账户:">
                                    <el-select v-model="acct" @change="switchAccounts">
                                        <el-option
                                            v-for="(item, index) in multiAccounts"
                                            :key="index"
                                            :label="item.label"
                                            :value="item.code"
                                        ></el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-button
                                    type="primary"
                                    @click="searchData1(0, 'L', '1-12个月账单查询')"
                                    size="small"
                                    icon="el-icon-search"
                                >1-12个月账单查询</el-button>
                                <el-button
                                    type="primary"
                                    @click="searchData1(1, 'L', '13-24个月账单查询')"
                                    size="small"
                                    icon="el-icon-search"
                                >13-24个月账单查询</el-button>
                            </el-col>
                        </el-row>
                    </el-form>
                    <!-- <div class="header-btn foote">
                        <el-button
                            type="primary"
                            @click="searchData1(0, 'L', '1-12个月账单查询')"
                            size="small"
                        >1-12个月账单查询</el-button>
                        <el-button
                            type="primary"
                            @click="searchData1(1, 'L', '13-24个月账单查询')"
                            size="small"
                        >13-24个月账单查询</el-button>
                    </div>-->
                    <el-table
                        class="heard-bg business_table"
                        border
                        stripe
                        :data="tableData"
                        width="100%"
                    >
                        <el-table-column :label="masg">
                            <el-table-column label="账单日期">
                                <template slot-scope="scope">
                                    <span
                                        @click="handleViewDetail(scope.row)"
                                        style="cursor: pointer;color: #409EFF;"
                                    >{{scope.row.CLOSEDAY | formatDate}}</span>
                                </template>
                            </el-table-column>
                            <el-table-column label="账单金额">
                                <template slot-scope="scope">
                                    <span>{{scope.row.BALFLAG}}{{scope.row.CLOSEBAL}}</span>
                                </template>
                            </el-table-column>
                            <el-table-column label="最低还款额">
                                <template slot-scope="scope">
                                    <span>+{{scope.row.MINDUE}}</span>
                                </template>
                            </el-table-column>
                            <el-table-column label="到期还款日">
                                <template slot-scope="scope">
                                    <span>{{scope.row.CLOSEDAY | getNewDay(ODUETIME)}}</span>
                                </template>
                            </el-table-column>
                            <el-table-column label="消费笔数" prop="PURCHNBR"></el-table-column>
                            <el-table-column label="逾期金额">
                                <template slot-scope="scope">
                                    <span>+{{scope.row.ODUE}}</span>
                                </template>
                            </el-table-column>
                            <el-table-column label="逾期天数">
                                <template slot-scope="scope">
                                    <span>+{{scope.row.ODUEDAYS}}</span>
                                </template>
                            </el-table-column>
                        </el-table-column>
                    </el-table>
                </div>
                <div
                    v-show="!showFlag"
                    class="detaillist"
                    v-loading="isLoadingss"
                    element-loading-background="rgba(250, 250, 250, 0.7)"
                >
                    <el-card shadow="never" style="margin-bottom: 20px;">
                        <div slot="headerss" class="clearfix">
                            <span>
                                <!-- <strong>人民币 账单（账单年月：26-08 账户类别: 个人卡账户 ）</strong> masg2-->
                                <strong>{{masg2}}</strong>
                            </span>
                        </div>
                        <div class="arrearsQueryMain">
                            <el-form
                                ref="rowObjformRef"
                                :model="rowObj"
                                label-width="110px"
                                size="mini"
                            >
                                <el-row>
                                    <el-col :span="8">
                                        <el-form-item label="本期账单金额 : ">
                                            <el-input
                                                disabled
                                                :value="rowObj.STMTFLAG=== '+' ?rowObj.STMTAMT:rowObj.STMTFLAG + rowObj.STMTAMT"
                                                style="width: 90%; border: none"
                                            ></el-input>
                                        </el-form-item>
                                        <!-- <span class="queryMainLeft">本期应还金额：</span>
                                        <span class="queryMainLeft">{{rowObj.AMOUNT}}</span>-->
                                    </el-col>
                                    <el-col :span="8">
                                        <el-form-item label="最低还款额 : ">
                                            <el-input
                                                disabled
                                                v-model="rowObj.MINPAY"
                                                style="width: 90%; border: none"
                                            ></el-input>
                                        </el-form-item>
                                        <!-- <span class="queryMainLeft">	最低还款额：</span>
                                        {{rowObj.MINPAY}}-->
                                    </el-col>
                                    <el-col :span="8">
                                        <el-form-item label="到期还款日 : ">
                                            <el-input
                                                disabled
                                                :value="rowObj.CLOSEDAY | getNewDay(ODUETIME)"
                                                style="width: 90%; border: none"
                                            ></el-input>
                                        </el-form-item>
                                        <!-- <span class="queryMainLeft">本期账单金额：</span>
                                        <span class="queryMainLeft">{{rowObj.STMTFLAG}}{{rowObj.STMTAMT}}</span>-->
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="8">
                                        <el-form-item label="上期账单金额 : ">
                                            <el-input
                                                disabled
                                                :value="rowObj.OPENFLAG=== '+' ?rowObj.OPENAMT:rowObj.OPENFLAG + rowObj.OPENAMT"
                                                style="width: 90%; border: none"
                                            ></el-input>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="8">
                                        <el-form-item label="已还款金额 : ">
                                            <el-input
                                                disabled
                                                v-model="rowObj.PAYED"
                                                style="width: 90%; border: none"
                                            ></el-input>
                                        </el-form-item>
                                        <!-- <span class="queryMainLeft">上期账单金额：</span>
                                        <span class="queryMainLeft">{{rowObj.OPENFLAG}}{{rowObj.OPENAMT}}</span>-->
                                    </el-col>
                                    <el-col :span="8">
                                        <el-form-item label="本期调整金额 : ">
                                            <el-input
                                                disabled
                                                :value="rowObj.ADJFLAG=='+'? rowObj.ADJUSTMENT:rowObj.ADJFLAG + rowObj.ADJUSTMENT"
                                                style="width: 90%; border: none"
                                            ></el-input>
                                        </el-form-item>
                                        <!-- <span class="queryMainLeft">	已还款金额：</span>
                                        <span class="queryMainLeft">{{rowObj.PAYED}}</span>-->
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="8">
                                        <el-form-item label="本期消费金额 : ">
                                            <el-input
                                                disabled
                                                :value="rowObj.PURCHAMT"
                                                style="width: 90%; border: none"
                                            ></el-input>
                                        </el-form-item>
                                        <!-- <span class="queryMainLeft">本期新增账款：</span>
                                        <span class="queryMainLeft">{{billamt}}</span>-->
                                    </el-col>
                                    <el-col :span="8">
                                        <el-form-item label="本期取现金额 : ">
                                            <el-input
                                                disabled
                                                :value="rowObj.CASHAD"
                                                style="width: 90%; border: none"
                                            ></el-input>
                                        </el-form-item>
                                        <!-- <span class="queryMainLeft">	本期调整金额：</span>
                                        <span class="queryMainLeft">{{rowObj.ADJFLAG}}{{rowObj.ADJUSTMENT}}</span>-->
                                    </el-col>
                                    <el-col :span="8">
                                        <el-form-item label="本期费用 : ">
                                            <el-input
                                                disabled
                                                :value="rowObj.PENTLY|getFeeAMT(rowObj.OTHERFEE,rowObj.CASHADFEE,rowObj.CARDFEE)"
                                                style="width: 90%; border: none"
                                            ></el-input>
                                        </el-form-item>
                                        <!-- <span class="queryMainLeft">循环利息：</span>
                                        <span class="queryMainLeft">{{rowObj.CREDITINST}}</span>-->
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="24">
                                        <el-form-item style="margin-bottom: 0;" label="本期账单金额 : ">
                                            <!-- <span class="el-form-item-span width100">{{BQSD}}</span> -->
                                            <el-input
                                                class="textareaStyle"
                                                type="textarea"
                                                :autosize="{minRows:2,maxRows:3}"
                                                disabled
                                                :value="BQSD"
                                            ></el-input>
                                        </el-form-item>
                                        <!-- <span class="queryMainLeft">	计算规则：</span>
                                        <span class="queryMainLeft">本期账单金额＝上期账单金额－已还款金额＋本期新增账款＋本期调整金额＋循环利息</span>-->
                                    </el-col>
                                </el-row>
                            </el-form>
                        </div>
                    </el-card>

                    <!-- <div class="tableTitle">人民币账单</div> -->

                    <el-table
                        class="heard-bg business_table"
                        :data="detailData"
                        @current-change="handleCurrentChange"
                        border
                        stripe
                        width="100%"
                    >
                        <el-table-column label width="35">
                            <template slot-scope="scope">
                                <el-radio v-model="isChecked" :label="scope.row">{{""}}</el-radio>
                            </template>
                        </el-table-column>
                        <el-table-column
                            label="交易日期时间"
                            show-overflow-tooltip
                            min-width="120"
                            v-if="nextFlag"
                        >
                            <template slot-scope="scope">
                                <span>{{ scope.row.PURTIME | getFormatDate(scope.row.VALDATE+'', scope.row.PURDATE1+'') }}</span>
                            </template>
                        </el-table-column>
                        <el-table-column
                            label="交易日期时间"
                            show-overflow-tooltip
                            min-width="120"
                            v-else
                        >
                            <template slot-scope="scope">
                                <span>{{ scope.row.PURTIME | getFormatDate(scope.row.VALDATE+'', scope.row.PURDATE4+'') }}</span>
                            </template>
                        </el-table-column>
                        <el-table-column label="记账日" min-width="75" v-if="nextFlag">
                            <template slot-scope="scope">
                                <span>{{scope.row.PURDATE | formatDate}}</span>
                            </template>
                        </el-table-column>
                        <el-table-column label="记账日" min-width="75" v-else>
                            <template slot-scope="scope">
                                <span>{{scope.row.PURDATE8 | formatDate}}</span>
                            </template>
                        </el-table-column>
                        <el-table-column label="交易描述" show-overflow-tooltip min-width="200">
                            <template slot-scope="scope">
                                <span>{{scope.row.DESLINE1 || ""}} &nbsp; {{scope.row.DESLINE2 || "" }}</span>
                            </template>
                        </el-table-column>
                        <!-- <el-table-column label="交易类型" prop="TRANTYPE_1" min-width="150"></el-table-column>
                        <el-table-column label="商户类型代码" prop="MCC" min-width="75"></el-table-column>-->
                        <el-table-column label="交易金额" show-overflow-tooltip min-width="100">
                            <template slot-scope="scope">
                                <span>{{scope.row.AMOUNT |formatAmount(scope.row.AMOUNTFL)}}</span>
                            </template>
                        </el-table-column>
                        <el-table-column label="授权号码" show-overflow-tooltip min-width="100">
                            <template slot-scope="scope">
                                <span>{{scope.row.AUTHCODE }}</span>
                            </template>
                        </el-table-column>
                        <el-table-column label="交易流水号" prop="TRANNO" min-width="60"></el-table-column>
                        <el-table-column label="卡号末四位" min-width="68">
                            <template slot-scope="scope">
                                <span>{{scope.row.CARDEND | formatCardend}}</span>
                            </template>
                        </el-table-column>
                    </el-table>
                    <!-- 话术 -->
                    <div class="hstable_wrap" v-if="speechList.length!=0">
                        <el-table
                            :data="speechList"
                            border
                            stripe
                            header-row-class-name="headerRow"
                            ref="showListTable"
                            class="heard-bg business_table hstable"
                            @selection-change="handleSelectionChange"
                        >
                            <el-table-column type="selection" label=" " min-width="55"></el-table-column>
                            <el-table-column label="业务话术">
                                <template slot-scope="scope">{{scope.row.content}}</template>
                            </el-table-column>
                        </el-table>
                    </div>
                    <div class="footer">
                        <!--<el-button type="primary" size="small" @click="choice()">争议账款工单</el-button>-->
                        <el-button type="primary" plain size="small" @click="stmtapp()">账单分期申请</el-button>
                        <!--<el-button type="primary" plain size="small" @click="setqry()">账单寄送方式</el-button>
                        <el-button type="primary" plain size="small" @click="zxmrapp()">补印账单申请</el-button>-->
                        <el-button type="primary" size="small" @click="sendMsg()">发送短信</el-button>
                        <el-button size="small" @click="goBack()">返 回</el-button>
                        <el-button
                            :disabled="currentPageIndex <= 0"
                            type="primary"
                            size="small"
                            @click="handleChangePage('pre')"
                        >上一页</el-button>
                        <el-button
                            :disabled="nextButtonFlag"
                            type="primary"
                            size="small"
                            @click="handleChangePage('next')"
                        >下一页</el-button>
                        <el-button
                            :disabled="lastButtonFlag"
                            type="primary"
                            size="small"
                            @click="handleLastPage()"
                        >尾页</el-button>
                        <span class="pageInfo">{{PG}}</span>
                    </div>
                </div>
            </template>
        </cardComponent>
    </div>
</template>

<script>
import { mapState } from 'vuex';
import moment from 'moment';
import {
    getAccountTypeName,
    getDictSelectList,
    myMoment, getBusinessMenuId
} from '@/utils/Common';
import cardComponent from '@/components/cardComponent/cardComponent.vue';
import { get_4xxx, get_3xxx } from '@/apis/getAPIClass';
import { isEmptyObject, ChangePage } from '@/utils/Object';
import { getToken, getTokenHsbankNo } from '@/utils/auth';
export default {
    name: 'billChecked',
    data() {
        return {
            acct: '',
            currency: '',
            bnknbr: getTokenHsbankNo('HsbankNo'),
            ITEMCM: '',
            // 表格内容
            tableData: [],
            detailData: [],
            dateFlag: 0,
            currentApprefIndex: '', // 当前页最后一条记录的申请编号的索引
            nextButtonFlag: true, // ‘下一页’  按钮的显示控制阀
            pagingDataList: [], // 翻页上送字段列表
            currentPageIndex: 0, // 当前页索引
            showFlag: true,
            rowObj: {},
            billamt: '0.00',
            isChecked: {},
            ODUETIME: '25',
            option: 'L',
            masg2: '',
            TRANTYPEList: [],
            result_3053: '',
            masg: '人民币1-6个月账单查询',
            TRANYM: '',
            currentRow: null,
            VALDATE: '',
            PURDATE: '',
            PURTIME: '',
            TRANNO: '',
            nextFlag: true,
            PURDATE8: '',
            isLoadings: false,
            isLoadingss: false,
            isLoading: false,//这个是 假loading 公共方法里 有这个变量 不要删
            totalSumMap: {
                zzdqk: 0,
                zzdzdhke: 0,
                zxfbs: 0,
                yczdzyqje: 0,
            },
            currentZd: {},
            dufaultCard: '',
            result_firstlist: {},//最近六期账单
            BQSD: '',  //本期账单计算过程
            RtnindFlag: '0',
            pageList: [],//翻页查询数据，保存每一页的最后一条数据
            RtnindFlagAll: '0',
            resultlist: [],//保存所有明细记录
            detailDataAll: [],//保存当前页记录
            totCnt: 0,//总条数
            totPgCnt: 0,//总页数
            PG: '',//页数信息
            lastButtonFlag: true,
            speechList: [],//话术列表
            selectedList: [],
            MenuId: '',
            bsAcctList: [],//包商账户类别列表
        };
    },
    computed: mapState({
        cardInfo_3004: state => state.common.cardInfo_3004,
        cardList_3601: state => state.common.cardList_3601, // 卡列表数据
        defaultParams: state => state.common.defaultParams,
        defaultpinFlag: state => state.common.pinFlag,
        multiAccounts: state => state.common.AccountionTYPE_INFO,
        isCurrentMenuInfo: state => state.menu.isCurrentMenuInfo,
        businessMenu: state => state.menu.businessMenu,
    }),
    async created() {

        // 调用3054接口，查询已出账单列表
        //this.getData();

        // 计算多账户累加数据 3054
        //this.calTotalSum();
        // 获取账户类型
        this.ITEMCM = await getAccountTypeName(
            this.cardList_3601,
            this.cardInfo_3004,
            this,
        ) || this.cardInfo_3004.CATEGORY;
        this.TRANTYPEList = await getDictSelectList('TRANS_TYPE', this);



        // const params = {
        //     cfgNo: '9034',
        //     bankNum: getTokenHsbankNo('HsbankNo'),
        //     sect: '0000',
        // };
        // this.$post.dictDetail.queryConfig(params).then((res) => {
        //     if (res.data.content) {
        //         console.log("11111111111111111111", this.cardInfo_3004.CATEGORY);
        //         this.ODUETIME = res.data.content.cfgEdit || 25;
        //     }
        // });




    },

    async mounted() {
        this.MenuId = this.$route.params.id || '';
        this.bsAcctList = await getDictSelectList('BS_ACCTTYPE', this);
        // 计算多账户总金额信息
        //this.calTotalSum();
        console.log('111:' + this.cardInfo_3004.CATEGORY);
        this.switchAccounts(this.cardInfo_3004.CATEGORY + '');
        this.currency = 'L';
        await this.getspeechList();
    },

    methods: {

        calTotalSum() {
            // 总消费金额 总还款金额 总取现金额 总取现手续费金额
            this.multiAccounts.forEach(item => {
                this.getAccountSum(item.CARDNBR);
            });

        },
        //点击切换账户类型
        switchAccounts(val) {
            console.log('val', val);
            this.acct = val;
            console.log(this.acct);
            this.bsAcctList.some((item) => {
                if (item.code + '' === val + '') {
                    this.ODUETIME = 20;
                    return true;
                } else {
                    this.ODUETIME = 25;
                }
            });

            this.multiAccounts.forEach(item => {
                if (item.code + '' === val) {
                    this.defaultCard = item.CARDNBR;
                }
            });
            console.log("2222" + this.defaultCard);
            this.searchData1(0, 'L', '1-12个月账单查询');

        },
        //点击切换币种
        changeCurr(val) {
            console.log("币种：" + val);
            this.searchData1(0, val, '1-12个月账单查询');
        },
        //根据菜单id查询话术列表
        async getspeechList() {
            console.log("this.isCurrentMenuInfo.id", this.isCurrentMenuInfo.id);
            var checkParam = {
                'id': this.MenuId || this.isCurrentMenuInfo.id,
            };
            this.$post.busiMenu.getlistByMenuId(checkParam).then((res) => {
                console.log("话术查询结果：", res);
                if (res.status === 200) { // http通讯成功
                    if (res.data.status == 0) { // 业务请求成功
                        this.speechList = res.data.content;
                    }
                }
            });
        },
        handleSelectionChange(val) {
            this.selectedList = val;
        },
        // 根据卡号查询账户下账单信息列表
        getAccountSum(cardNo) {

            const appBody_3054 = {
                CARDNBR: cardNo, // 卡号
                OPTION: 'L',
                PINFLAG: this.defaultpinFlag, // 是否检查密码标志
                QUERY: '0',
            };
            const params_3054 = JSON.parse(JSON.stringify(this.defaultParams));
            params_3054.body.appHead.tranCode = '3054';
            params_3054.body.appBody = appBody_3054;

            this.$post.common.transPort(params_3054).then((res) => {

                if (res.status === 200) {
                    const result = JSON.parse(res.data.jsonRes);
                    if (result.sysHead.rspCd === '000000') {

                        let tableList = result.body.appBody.dataList || [];

                        if (tableList.length > 0) {

                            let zdqk = tableList[0].BALFLAG + tableList[0].CLOSEBAL;
                            let zdhke = tableList[0].MINDUE;
                            let xfbs = tableList[0].PURCHNBR;
                            let yqje = tableList[0].ODUE;

                            this.totalSumMap.zzdqk = (parseFloat(this.totalSumMap.zzdqk) + parseFloat(zdqk)).toFixed(2);
                            this.totalSumMap.zzdzdhke = (parseFloat(this.totalSumMap.zzdzdhke) + parseFloat(zdhke)).toFixed(2);
                            this.totalSumMap.zxfbs = parseFloat(this.totalSumMap.zxfbs) + parseFloat(xfbs);
                            this.totalSumMap.yczdzyqje = (parseFloat(this.totalSumMap.yczdzyqje) + parseFloat(yqje)).toFixed(2);

                        }

                    } else {

                    }
                } else {

                }
            });

        },

        // 点击账单日期，调用3005 查询信用卡账单头信息，调用3006 查询信用卡账单明细
        // 调用3091 查询历史信用卡账单头信息，调用3092 查询历史信用卡账单明细 
        async handleViewDetail(val) {
            this.isLoadings = true;
            this.resultlist = [];
            this.pageList = [];
            //判断点击的账单日期是否在1-6个月之内，
            this.nextFlag = false;
            console.log("近6个月账单列表有没得：", this.result_firstlist);
            if (!isEmptyObject(this.result_firstlist)) {
                for (let index = 0; index < this.result_firstlist.body.appBody.dataList.length; index++) {
                    const element = this.result_firstlist.body.appBody.dataList[index];
                    if (element.CLOSEDAY === val.CLOSEDAY) {
                        this.nextFlag = true;
                    }
                }
            }

            // console.log(val)
            this.TRANYM = (`${val.CLOSEDAY}`).substr(2, 4);
            this.defaultParams.sysHead.busiName = '信用卡账单明细查询';

            // 当前1-6个月
            if (this.nextFlag) {
                console.log("val1-6", val);
                // 3005 配置请求头
                const appBody_3005 = {
                    CARDNBR: this.defaultCard || '', // 卡号
                    TRANYM: this.TRANYM,
                    OPTION: this.option,
                    PINFLAG: this.defaultpinFlag,
                };
                console.log("appBody_3005", appBody_3005);
                const defaultParams_3005 = JSON.parse(JSON.stringify(this.defaultParams));
                defaultParams_3005.body.appHead.tranCode = '3005';
                defaultParams_3005.body.appHead.source = 'AG';
                defaultParams_3005.body.appBody = appBody_3005;
                this.$post.common.transPort(defaultParams_3005).then((res) => {
                    if (res.status === 200) {
                        const result = JSON.parse(res.data.jsonRes);
                        if (result.sysHead.rspCd === '000000') {
                            this.rowObj = { ...result.body.appBody, ...val };
                            console.log(this.rowObj, result, val);
                            const openflag = this.rowObj.OPENFLAG;
                            let openamt = this.rowObj.OPENAMT; // 上期欠款金额
                            const adjflag = this.rowObj.ADJFLAG;
                            let adjustment = this.rowObj.ADJUSTMENT; // 本期调整金额
                            const stmtflag = this.rowObj.STMTFLAG;
                            let stmtamt = this.rowObj.STMTAMT; // 本期欠款金额
                            const payed = this.rowObj.PAYED; // 还款金额
                            const creditinst = this.rowObj.CREDITINST; // 循环利息

                            const cashad = this.rowObj.CASHAD;
                            const purchamt = this.rowObj.PURCHAMT;

                            const otherfee = this.rowObj.OTHERFEE;//其他费用
                            const pently = this.rowObj.PENTLY;//罚金
                            const cashadfee = this.rowObj.CASHADFEE;//取现手续费
                            const cardfee = this.rowObj.CARDFEE;//卡片费用

                            const totfee = parseFloat(otherfee) + parseFloat(pently) + parseFloat(cashadfee) + parseFloat(cardfee);   //本期费用

                            if (openflag === '-') {
                                openamt *= -1;
                            }
                            if (adjflag === '-') {
                                adjustment *= -1;
                            }
                            if (stmtflag === '-') {
                                stmtamt *= -1;
                            }
                            function ForDight(Dight, How) {
                                var Dight = Math.round(Dight * Math.pow(10, How)) / Math.pow(10, How);
                                return Dight;
                            }
                            // 上期欠款金额－还款金额＋本期账单金额＋本期调整金额＋循环利息＝本期欠款金额
                            // 计算本期账单金额
                            this.billamt = parseFloat(stmtamt)
                                - parseFloat(creditinst)
                                - parseFloat(adjustment)
                                + parseFloat(payed)
                                - parseFloat(openamt);
                            this.billamt = this.billamt.toFixed(2);

                            this.masg2 = `${this.rowObj.OPTION == 'L' ? '人民币' : '美元'
                                } 账单（账单年月：${moment(`${val.CLOSEDAY}`).format(
                                    'YY-MM',
                                )}    账户类别: ${this.ITEMCM} ）`;

                            var t_c = '';

                            if (openflag === '-') {
                                t_c = `(${parseFloat(openamt)})`;
                            } else {
                                t_c = `${parseFloat(openamt)}`;
                            }

                            t_c = `${t_c} - ${parseFloat(payed).toFixed(2)}`;
                            if (adjflag === '-') {
                                t_c = `${t_c} + (${parseFloat(adjustment)})`;
                            } else {
                                t_c = `${t_c} + ${parseFloat(adjustment)}`;
                            }
                            t_c = `${t_c} + ${parseFloat(purchamt)}`;
                            t_c = `${t_c} + ${parseFloat(cashad)}`;
                            t_c = `${t_c} + ${parseFloat(totfee)}`;

                            t_c = `${t_c} + ${parseFloat(creditinst)}`;


                            // 计算本期账单金额 = 上期账单金额 - 已还金额 + 本期消费金额 + 本期取现金额 + 本期费用 + 本期调整金额 + 循环利息 
                            const bq = parseFloat(openamt) - parseFloat(payed) + parseFloat(adjustment) + parseFloat(purchamt) + parseFloat(cashad) + parseFloat(totfee) + parseFloat(creditinst);
                            const txt = `上期账单金额(${parseFloat(openamt)}) - 已还金额(${parseFloat(payed)}) + 本期调整金额(${parseFloat(adjustment)}) + 本期消费金额(${parseFloat(purchamt)}) + 本期取现金额(${parseFloat(cashad)}) + 本期费用(${parseFloat(totfee)}) + 循环利息(${parseFloat(creditinst)}) = ${ForDight(bq, 2)}`;
                            this.BQSD = txt;

                        }
                    }
                });
                // 请求3006接口
                console.log(this.TRANYM);
                await this.get_3006('3006');

                await this.queryall(val, '3006');
                this.isLoadings = false;
            } else {
                console.log("val7-12", val);


                // 3005 配置请求头
                const appBody_3091 = {
                    CARDNBR: this.defaultCard || '', // 卡号
                    TRANYM: this.TRANYM,
                    OPTION: this.option,
                    PINFLAG: this.defaultpinFlag,
                };
                console.log("appBody_3091", appBody_3091);
                // 历史账单
                const defaultParams_3091 = JSON.parse(
                    JSON.stringify(this.defaultParams),
                );
                defaultParams_3091.body.appHead.tranCode = '3091';
                defaultParams_3091.body.appHead.source = 'AG';
                defaultParams_3091.body.appBody = appBody_3091;
                this.$post.common.transPort(defaultParams_3091).then((res) => {
                    if (res.status === 200) {
                        const result = JSON.parse(res.data.jsonRes);
                        if (result.sysHead.rspCd === '000000') {
                            this.rowObj = { ...result.body.appBody, ...val };
                            console.log(this.rowObj, result, val);
                            const openflag = this.rowObj.OPENFLAG;
                            let openamt = this.rowObj.OPENAMT; // 上期欠款金额
                            const adjflag = this.rowObj.ADJFLAG;
                            let adjustment = this.rowObj.ADJUSTMENT; // 本期调整金额
                            const stmtflag = this.rowObj.STMTFLAG;
                            let stmtamt = this.rowObj.STMTAMT; // 本期欠款金额
                            const payed = this.rowObj.PAYED; // 还款金额
                            const creditinst = this.rowObj.CREDITINST; // 循环利息

                            const cashad = this.rowObj.CASHAD;
                            const purchamt = this.rowObj.PURCHAMT;

                            const otherfee = this.rowObj.OTHERFEE;//其他费用
                            const pently = this.rowObj.PENTLY;//罚金
                            const cashadfee = this.rowObj.CASHADFEE;//取现手续费
                            const cardfee = this.rowObj.CARDFEE;//卡片费用

                            const totfee = parseFloat(otherfee) + parseFloat(pently) + parseFloat(cashadfee) + parseFloat(cardfee);   //本期费用

                            if (openflag === '-') {
                                openamt *= -1;
                            }
                            if (adjflag === '-') {
                                adjustment *= -1;
                            }
                            if (stmtflag === '-') {
                                stmtamt *= -1;
                            }
                            function ForDight(Dight, How) {
                                var Dight = Math.round(Dight * Math.pow(10, How)) / Math.pow(10, How);
                                return Dight;
                            }

                            // 上期欠款金额－还款金额＋本期账单金额＋本期调整金额＋循环利息＝本期欠款金额
                            // 计算本期账单金额
                            this.billamt = parseFloat(stmtamt)
                                - parseFloat(creditinst)
                                - parseFloat(adjustment)
                                + parseFloat(payed)
                                - parseFloat(openamt);
                            this.billamt = this.billamt.toFixed(2);

                            this.masg2 = `${this.rowObj.OPTION == 'L' ? '人民币' : '美元'
                                } 账单（账单年月：${moment(`${val.CLOSEDAY}`).format(
                                    'YY-MM',
                                )}    账户类别: ${this.ITEMCM} ）`;

                            var t_c = '';

                            if (openflag === '-') {
                                t_c = `(${parseFloat(openamt)})`;
                            } else {
                                t_c = `${parseFloat(openamt)}`;
                            }

                            t_c = `${t_c} - ${parseFloat(payed).toFixed(2)}`;
                            if (adjflag === '-') {
                                t_c = `${t_c} + (${parseFloat(adjustment)})`;
                            } else {
                                t_c = `${t_c} + ${parseFloat(adjustment)}`;
                            }
                            t_c = `${t_c} + ${parseFloat(purchamt)}`;
                            t_c = `${t_c} + ${parseFloat(cashad)}`;
                            t_c = `${t_c} + ${parseFloat(totfee)}`;

                            t_c = `${t_c} + ${parseFloat(creditinst)}`;


                            // 计算本期账单金额 = 上期账单金额 - 已还金额 + 本期消费金额 + 本期取现金额 + 本期费用 + 本期调整金额 + 循环利息 
                            const bq = parseFloat(openamt) - parseFloat(payed) + parseFloat(adjustment) + parseFloat(purchamt) + parseFloat(cashad) + parseFloat(totfee) + parseFloat(creditinst);
                            const txt = `上期账单金额(${parseFloat(openamt).toFixed(2)}) - 已还金额(${parseFloat(payed).toFixed(2)}) + 本期调整金额(${parseFloat(adjustment).toFixed(2)}) + 本期消费金额(${parseFloat(purchamt).toFixed(2)}) + 本期取现金额(${parseFloat(cashad).toFixed(2)}) + 本期费用(${parseFloat(totfee).toFixed(2)}) + 循环利息(${parseFloat(creditinst).toFixed(2)}) = ${ForDight(bq, 2)}`;
                            this.BQSD = txt;
                        }
                    }
                });
                await this.get_3006('3092');

                await this.queryall(val, '3092');
                this.isLoadings = false;
            }
            if (this.detailData != []) {
                this.showFlag = false;
            }

            if (this.dateFlag === '0') {
                // 1-6月账单明细
            } else {
                // 7-12月账单明细
            }
        },
        async get_3006(a) {
            // 3006 配置请求头
            // this.isLoadings = true;
            const appBody_3006 = {
                CARDNBR: this.defaultCard || '', // 卡号
                TRANYM: this.TRANYM, // 账单年月YYMM，当送零时，系统默认查询账户当前月份-1，即最近一期账单月的账单
                OPTION: this.option, // 币种选项
                PINFLAG: this.defaultpinFlag,
                RTNIND: this.RtnindFlag, // 翻页标志 首次传空， 翻页传1
                ENQFLAG: 0, // 0：返回账户交易明细，默认方式；1：按查询卡号返回交易明细
                VALDATE: this.VALDATE,
                PURDATE: this.PURDATE || this.PURDATE8,
                PURTIME: this.PURTIME,
                TRANNO: this.TRANNO,
            };

            let bool = false;
            if (this.pagingDataList.length === 0) bool = true;
            const result = await get_3xxx(
                a,
                '已出账单明细查询',
                appBody_3006,
                this,
                true,
                bool,
            );
            //this.isLoadings = false;
            if (!result) {
                if (this.pagingDataList.length != 0) {
                    this.$message.warning('已经到最后一条数据');
                } else {
                    this.detailData = [];
                }
                this.nextButtonFlag = true;
                return false;
            }

            const res = result.body.appBody.dataList;
            this.RtnindFlag = result.body.appBody.RTNIND;
            // res.forEach((e) => {
            //     e.TRANTYPE_1 = e.TRANTYPE;
            //     // 设置分期付款类型
            //     this.TRANTYPEList.forEach((i) => {
            //         if ((`${e.TRANTYPE}`).trim() == i.code) {
            //             e.TRANTYPE_1 = `${i.code} ${i.label}`;
            //         }
            //     });
            // });
            console.log(res, 'res');
            this.detailData = res;
            this.currentPageIndex = this.currentPageIndex + 1;
            // 设置下一页分页设置VALDATE
            // if (this.nextFlag) {
            //     ChangePage(
            //         this,
            //         ['VALDATE', 'PURDATE', 'PURTIME', 'TRANNO'],
            //         'detailData',
            //     );
            // } else {
            //     ChangePage(
            //         this,
            //         ['VALDATE', 'PURDATE8', 'PURTIME', 'TRANNO'],
            //         'detailData',
            //     );
            // }
            console.log("this.currentPageIndex1:", this.currentPageIndex);
            let curInd = this.currentPageIndex + 1;
            console.log("curInd", curInd);
            this.PG = '第' + curInd + '页/共' + this.totPgCnt + '页';

            if (curInd === this.totPgCnt) {
                this.nextButtonFlag = true;
                this.lastButtonFlag = true;
            } else {
                this.nextButtonFlag = false;
                this.lastButtonFlag = false;
            }
        },

        //查询所有明细
        async queryall(val, ym) {
            console.log("ym", ym);
            const appBody = {
                CARDNBR: this.defaultCard || '', // 卡号
                TRANYM: this.TRANYM,
                OPTION: this.option,
                PINFLAG: this.defaultpinFlag,
                RTNIND: this.RtnindFlagAll, // 翻页标志 首次传空， 翻页传1
                ENQFLAG: 0, // 0：返回账户交易明细，默认方式；1：按查询卡号返回交易明细
                VALDATE: this.VALDATE,
                PURDATE: this.PURDATE,
                PURTIME: this.PURTIME,
                TRANNO: this.TRANNO,
            };
            console.log("appBody", appBody);
            const defaultParams = JSON.parse(JSON.stringify(this.defaultParams));
            defaultParams.body.appHead.tranCode = ym;
            defaultParams.body.appBody = appBody;
            // 3077交易

            await this.$post.common.transPort(defaultParams).then(async (res) => {
                if (res.status === 200) {
                    const result = JSON.parse(res.data.jsonRes);
                    if (result.sysHead.rspCd === '000000') {
                        this.resultlist.push(...result.body.appBody.dataList);
                        console.log("result.body.appBody.RTNIND", result.body.appBody.RTNIND);
                        // 修改翻页标志 
                        this.RtnindFlagAll = result.body.appBody.RTNIND;
                        this.detailDataAll = result.body.appBody.dataList;

                        this.VALDATE = result.body.appBody.dataList[result.body.appBody.dataList.length - 1].VALDATE;
                        if (ym === '3006') {
                            this.PURDATE = result.body.appBody.dataList[result.body.appBody.dataList.length - 1].PURDATE;
                        } else {
                            this.PURDATE = result.body.appBody.dataList[result.body.appBody.dataList.length - 1].PURDATE8;
                        }
                        console.log("this.PURDATE", this.PURDATE);
                        this.PURTIME = result.body.appBody.dataList[result.body.appBody.dataList.length - 1].PURTIME;
                        this.TRANNO = result.body.appBody.dataList[result.body.appBody.dataList.length - 1].TRANNO;
                        const currentPagingData = {
                            VALDATE: result.body.appBody.dataList[result.body.appBody.dataList.length - 1].VALDATE,
                            PURDATE: this.PURDATE,
                            PURTIME: result.body.appBody.dataList[result.body.appBody.dataList.length - 1].PURTIME,
                            TRANNO: result.body.appBody.dataList[result.body.appBody.dataList.length - 1].TRANNO,
                        };
                        this.pageList.push(currentPagingData);
                        if (result.body.appBody.RTNIND === '1') {

                            await this.queryall(val, ym);
                        } else {

                            console.log('this.resultlist', this.resultlist);
                            this.totCnt = this.resultlist.length;
                            console.log("totCnt", this.totCnt);
                            console.log("detailDataAll", this.detailDataAll);

                            this.totPgCnt = Math.ceil(this.totCnt / 10);
                            this.currentPageIndex = 0;
                            this.pagingDataList = this.pageList;
                            this.PG = '第1页/共' + this.totPgCnt + '页';
                            console.log("this.pageList", this.pageList);
                            if (this.totPgCnt != 1) {
                                this.lastButtonFlag = false;
                                this.nextButtonFlag = false;
                            } else {
                                this.nextButtonFlag = true;
                                this.lastButtonFlag = true;
                            }
                            this.isLoadings = false;
                        }
                    }
                }
            });

        },

        //尾页
        handleLastPage() {
            this.detailData = this.detailDataAll;
            this.pagingDataList = this.pageList;
            this.PG = '第' + this.totPgCnt + '页/共' + this.totPgCnt + '页';
            this.nextButtonFlag = true;
            this.lastButtonFlag = true;
            this.currentPageIndex = this.totPgCnt - 1;
            console.log("this.currentPageIndex", this.currentPageIndex);
            console.log("this.pagingDataList", this.pagingDataList);
        },
        // 争议账款工单
        choice() {
            if (isEmptyObject(this.isChecked)) {
                this.$alert('请选择交易流水！', '提示', {
                    customClass: 'warning', type: 'warning',
                });
            }
        },
        // 账单分期申请
        stmtapp() {
            this.MenuId = getBusinessMenuId('/instalment/InstallmentBillApplication', this.businessMenu);
            console.log('this.MenuId____', this.MenuId);
            this.$router.push({ name: 'InstallmentBillApplication', path: '/instalment/InstallmentBillApplication', params: { id: this.MenuId } });
        },
        // 账单寄送方式
        setqry() {
            this.$router.push('/operationDeals/BillDeliveryAddress');
        },
        // 补印账单申请
        zxmrapp() {
            this.$router.push('/operationDeals/ReprintBillApplyFor');
        },
        // 发送短信
        //尊敬的客户：您信用卡XXXX年X月本期应还：XXXX.XX元，最低还款额：XX.XX元，最后还款日：XXXX/XX/XX。
        sendMsg() {
            const DUEDATE = this.rowObj.DUEDATE === '99999999' ? '见单即付' : `${this.rowObj.DUEDATE.substring(0, 4)}/${this.rowObj.DUEDATE.substring(4, 6)}/${this.rowObj.DUEDATE.substring(6, 8)}`;
            const TAG = this.option === 'L' ? '元' : '美元';
            const TRANYM = this.rowObj.CLOSEDAY.toString();
            const YEAR = `${TRANYM.substring(0, 4)}`;
            const MONTH = `${TRANYM.substring(4, 6)}`;
            const tempContent = `尊敬的客户：您信用卡${YEAR}年${MONTH}月本期应还：${this.rowObj.AMOUNT}${TAG}，最低还款额：${this.rowObj.MINPAY}${TAG}，最后还款日：${DUEDATE}。`;
            this.$router.push({
                name: 'dynamicMessage',
                path: '/index/dynamicMessage',
                params: {
                    tempName: '100001-已出账单',
                    tempContent,
                },
            });
        },
        // 点击返回,清空缓存数据
        goBack() {
            this.showFlag = true;
            this.pagingDataList = [];
            this.pageList = [];
            this.RtnindFlagAll = '0';
            this.RtnindFlag = '0';

        },
        handleCurrentChange(val) {
            this.currentRow = val;
        },
        // 上下页切换
        async handleChangePage(type) {
            this.isLoadingss = true;
            console.log("开始加载了没得呀：", this.isLoadingss);
            this.currentRow = null;
            console.log("this.pagingDataList", this.pagingDataList);
            if (type === 'pre') {
                // 切换到上一页
                if (this.currentPageIndex - 2 < 0) {
                    this.currentPageIndex = this.currentPageIndex - 2;
                    //this.pagingDataList = []; // 清空缓存 申请编号 -> 相当于首次查询
                    this.RtnindFlag = '0';
                    this.VALDATE = '';
                    this.PURDATE = '';
                    this.PURTIME = '';
                    this.TRANNO = '';
                } else {
                    this.RtnindFlag = '1';
                    this.currentPageIndex = this.currentPageIndex - 2;
                    this.VALDATE = this.pagingDataList[this.currentPageIndex].VALDATE;
                    this.PURDATE = this.pagingDataList[this.currentPageIndex].PURDATE;
                    this.PURTIME = this.pagingDataList[this.currentPageIndex].PURTIME;
                    this.TRANNO = this.pagingDataList[this.currentPageIndex].TRANNO;
                }
                console.log("this.currentPageIndex0:", this.currentPageIndex);
                if (this.nextFlag) {
                    await this.get_3006('3006');
                } else {
                    await this.get_3006('3092');
                }
                console.log("加载完了没得呀123：", this.isLoadingss);
                this.isLoadingss = false;
                console.log("加载完了没得呀：", this.isLoadingss);
            } else {
                // 切换到下一页
                this.RtnindFlag = '1';
                console.log("pagingDataList:", this.pagingDataList);
                console.log("当前页索引:", this.currentPageIndex);
                this.VALDATE = this.pagingDataList[this.currentPageIndex].VALDATE;
                this.PURDATE = this.pagingDataList[this.currentPageIndex].PURDATE;
                this.PURTIME = this.pagingDataList[this.currentPageIndex].PURTIME;
                this.TRANNO = this.pagingDataList[this.currentPageIndex].TRANNO;
                if (this.nextFlag) {
                    await this.get_3006('3006');
                } else {
                    await this.get_3006('3092');
                }
                console.log("加载完了没得呀123：", this.isLoadingss);
                this.isLoadingss = false;
                console.log("加载完了没得呀：", this.isLoadingss);
            }

            console.log("this.currentPageIndex2: ", this.currentPageIndex);



        },
        searchData(num, k, a) {
            this.isLoadings = true;
            if (num == 1) {
                this.nextFlag = false;
            } else {
                this.nextFlag = true;
            }
            this.option = k;
            this.masg = a;
            this.dateFlag = num;
            this.getData();
        },
        async getData() {
            this.isLoadings = true;
            const result_3054 = await this.get_3054();
            //this.isLoadings = true;
            //const result_3053 = await this.get_3053();
            this.tableData = [];

            if (!result_3054) return false;
            //this.result_3053 = result_3053;

            this.tableData = result_3054.body.appBody.dataList || [];

        },
        async get_3054() {
            const appBody_3054 = {
                CARDNBR: this.defaultCard || '', // 卡号
                OPTION: this.option,
                PINFLAG: this.defaultpinFlag, // 是否检查密码标志
                QUERY: this.dateFlag,
            };
            const result_3054 = await get_3xxx(
                '3054',
                '卡片信用历史查询',
                appBody_3054,
                this,
                false,
            );
            if (!result_3054) return false;
            return result_3054;
        },
        async get_3053() {
            const appBody_3053 = {
                CARDNBR: this.defaultCard || '', // 卡号
                PINFLAG: this.defaultpinFlag, // 是否检查密码标志
                COVERTTY: 0,
            };
            const result_3053 = await get_3xxx(
                '3053',
                '信用卡账单应还款金额查询',
                appBody_3053,
                this,
            );
            if (!result_3053) return false;
            return result_3053;
        },

        searchData1(num, k, a) {
            this.isLoadings = true;
            // if (num == 0) {
            //     this.nextFlag = true;
            // } else {
            //     this.nextFlag = false;
            // }
            this.option = k;
            this.masg = a;
            this.dateFlag = num;
            this.getData1(num);
        },
        async getData1(num) {
            this.isLoadings = true;
            this.tableData = [];

            if (num === 0) {
                const result_3054_0 = await this.get_3054_0();
                console.log('result_3054_0', result_3054_0);
                this.result_firstlist = result_3054_0;

                if (!isEmptyObject(result_3054_0)) {
                    this.tableData = result_3054_0.body.appBody.dataList || [];
                }
                const result_3054_1 = await this.get_3054_1();
                if (!isEmptyObject(result_3054_1)) {
                    this.tableData = [...this.tableData, ...result_3054_1.body.appBody.dataList];
                    //this.tableData = [{ "ODUEDAYS": 0, "ODUE": 0, "PURCHNBR": 38, "OTHERFLG": "+", "DAYS": 0, "PAYMT": 0, "MINDUE": 0, "CLOSEDAY": 20210915, "INT": 0, "BALFLAG": "-", "OTHER": 728.21, "AGEING": 0, "CASHADVNBR": 0, "AMTCHGD": 0, "DUNCODE": "          ", "OTHERNBR": 39, "REVS": "                                  ", "OVERLIMIT": 0, "PAYMTNBR": 0, "CLOSEBAL": 419162.11, "INTCODE": 1, "PURCH": 9610.09, "CASHADV": 0 }, { "ODUEDAYS": 0, "ODUE": 0, "PURCHNBR": 76, "OTHERFLG": "+", "DAYS": 0, "PAYMT": 0, "MINDUE": 0, "CLOSEDAY": 20210815, "INT": 0, "BALFLAG": "-", "OTHER": 1641.91, "AGEING": 0, "CASHADVNBR": 1, "AMTCHGD": 0, "DUNCODE": "          ", "OTHERNBR": 78, "REVS": "                                  ", "OVERLIMIT": 0, "PAYMTNBR": 0, "CLOSEBAL": 429500.41, "INTCODE": 1, "PURCH": 50450.08, "CASHADV": 100 }, { "ODUEDAYS": 0, "ODUE": 0, "PURCHNBR": 76, "OTHERFLG": "+", "DAYS": 0, "PAYMT": 0, "MINDUE": 0, "CLOSEDAY": 20210715, "INT": 0, "BALFLAG": "-", "OTHER": 1641.91, "AGEING": 0, "CASHADVNBR": 0, "AMTCHGD": 0, "DUNCODE": "          ", "OTHERNBR": 78, "REVS": "                                  ", "OVERLIMIT": 0, "PAYMTNBR": 0, "CLOSEBAL": 481692.4, "INTCODE": 1, "PURCH": 50450.36, "CASHADV": 0 }, { "ODUEDAYS": 0, "ODUE": 0, "PURCHNBR": 76, "OTHERFLG": "+", "DAYS": 0, "PAYMT": 592600.34, "MINDUE": 0, "CLOSEDAY": 20210615, "INT": 7.15, "BALFLAG": "-", "OTHER": 1646.45, "AGEING": 0, "CASHADVNBR": 3, "AMTCHGD": 0, "DUNCODE": "          ", "OTHERNBR": 81, "REVS": "                                  ", "OVERLIMIT": 0, "PAYMTNBR": 10, "CLOSEBAL": 533784.67, "INTCODE": 1, "PURCH": 50450.3, "CASHADV": 2160 }, { "ODUEDAYS": 35, "ODUE": 1424.03, "PURCHNBR": 5, "OTHERFLG": "+", "DAYS": 12, "PAYMT": 0, "MINDUE": 4551.77, "CLOSEDAY": 20210515, "INT": 20.21, "BALFLAG": "+", "OTHER": 82.53, "AGEING": 1221.48, "CASHADVNBR": 0, "AMTCHGD": 0, "DUNCODE": "ORS       ", "OTHERNBR": 5, "REVS": "                                  ", "OVERLIMIT": 4551.77, "PAYMTNBR": 0, "CLOSEBAL": 4551.77, "INTCODE": 1, "PURCH": 3025, "CASHADV": 0 }, { "ODUEDAYS": 5, "ODUE": 1221.48, "PURCHNBR": 1, "OTHERFLG": "+", "DAYS": 42, "PAYMT": 0, "MINDUE": 1424.03, "CLOSEDAY": 20210415, "INT": 19.52, "BALFLAG": "+", "OTHER": 73.03, "AGEING": 1221.48, "CASHADVNBR": 1, "AMTCHGD": 0, "DUNCODE": "ORS OR ORS", "OTHERNBR": 6, "REVS": "                                  ", "OVERLIMIT": 1424.03, "PAYMTNBR": 0, "CLOSEBAL": 1424.03, "INTCODE": 1, "PURCH": 10, "CASHADV": 100 }];
                }
            } else {
                const result_3054_2 = await this.get_3054_2();
                if (!isEmptyObject(result_3054_2)) {
                    this.tableData = result_3054_2.body.appBody.dataList || [];
                }
                const result_3054_3 = await this.get_3054_3();
                if (!isEmptyObject(result_3054_3)) {
                    this.tableData = [...this.tableData, ...result_3054_3.body.appBody.dataList];
                }
            }

        },
        //3054查询1-6个月账单
        async get_3054_0() {
            const appBody_3054 = {
                CARDNBR: this.defaultCard || '', // 卡号
                OPTION: this.option,
                PINFLAG: this.defaultpinFlag, // 是否检查密码标志
                QUERY: '0',
            };
            let result_3054_0 = {};
            const params = JSON.parse(JSON.stringify(this.defaultParams));
            // console.log(this.defaultParams, 'this.defaultParams')
            params.body.appHead.tranCode = '3054';
            params.body.appBody = appBody_3054;
            await this.$post.common.transPort(params).then((res) => {
                if (res.status === 200) {
                    const result = JSON.parse(res.data.jsonRes);
                    if (result.sysHead.rspCd === '000000') {
                        console.log('result', result);
                        result_3054_0 = result;
                    }
                }
            });

            return result_3054_0;
        },
        //3054查询7-12个月账单
        async get_3054_1() {
            const appBody_3054 = {
                CARDNBR: this.defaultCard || '', // 卡号
                OPTION: this.option,
                PINFLAG: this.defaultpinFlag, // 是否检查密码标志
                QUERY: '1',
            };
            let result_3054_1 = {};
            const params = JSON.parse(JSON.stringify(this.defaultParams));
            // console.log(this.defaultParams, 'this.defaultParams')
            params.body.appHead.tranCode = '3054';
            params.body.appBody = appBody_3054;
            await this.$post.common.transPort(params).then((res) => {
                this.isLoadings = false;
                if (res.status === 200) {
                    const result = JSON.parse(res.data.jsonRes);
                    if (result.sysHead.rspCd === '000000') {
                        result_3054_1 = result;
                    }
                }
            });
            return result_3054_1;
        },
        //3054查询13-18个月账单
        async get_3054_2() {
            const appBody_3054 = {
                CARDNBR: this.defaultCard || '', // 卡号
                OPTION: this.option,
                PINFLAG: this.defaultpinFlag, // 是否检查密码标志
                QUERY: '2',
            };
            let result_3054_2 = {};
            const params = JSON.parse(JSON.stringify(this.defaultParams));
            // console.log(this.defaultParams, 'this.defaultParams')
            params.body.appHead.tranCode = '3054';
            params.body.appBody = appBody_3054;
            await this.$post.common.transPort(params).then((res) => {
                this.isLoadings = false;
                if (res.status === 200) {
                    const result = JSON.parse(res.data.jsonRes);
                    if (result.sysHead.rspCd === '000000') {
                        result_3054_2 = result;
                    }
                }
            });
            return result_3054_2;
        },
        //3054查询19-24个月账单
        async get_3054_3() {
            const appBody_3054 = {
                CARDNBR: this.defaultCard || '', // 卡号
                OPTION: this.option,
                PINFLAG: this.defaultpinFlag, // 是否检查密码标志
                QUERY: '3',
            };
            let result_3054_3 = {};
            const params = JSON.parse(JSON.stringify(this.defaultParams));
            // console.log(this.defaultParams, 'this.defaultParams')
            params.body.appHead.tranCode = '3054';
            params.body.appBody = appBody_3054;
            await this.$post.common.transPort(params).then((res) => {
                this.isLoadings = false;
                if (res.status === 200) {
                    const result = JSON.parse(res.data.jsonRes);
                    if (result.sysHead.rspCd === '000000') {
                        result_3054_3 = result;
                    }
                }
            });
            return result_3054_3;
        },

        // 授权交易明细查询
        authqry(authcode, card4end) {
            //this.$router.push('/businessSystem/cardAuthorizationTransaction');

            //const cardNo = this.currentSelect.CARDNBR.trim();
            this.$router.push({ name: 'CardAuthorizationTransaction', path: '/businessSystem/cardAuthorizationTransaction', params: { authcode, card4end } });
        },
        nfjm() {
            let cardno = this.defaultCard;
            this.$router.push({ name: 'CardAuthorizationTransaction', path: '/businessSystem/cardAuthorizationTransaction', params: { cardno } });
        },
    },
    filters: {
        // 到期还款日
        getNewDay(CLOSEDAY, ODUETIME) {
            const text = `${CLOSEDAY}`;
            console.log('打印日期时间格式', CLOSEDAY, text);

            const dateText = moment(text).format('YYYY-MM-DD');
            const dateTemp = dateText.split('-');
            const nDate = new Date(`${dateTemp[1]}-${dateTemp[2]}-${dateTemp[0]}`); // 转换为MM-DD-YYYY格式
            const millSeconds = Math.abs(nDate) + parseInt(ODUETIME) * 24 * 60 * 60 * 1000;
            const rDate = new Date(millSeconds);
            const year = rDate.getFullYear();
            let month = rDate.getMonth() + 1;
            if (month < 10) month = `0${month}`;
            let date = rDate.getDate();
            if (date < 10) date = `0${date}`;
            return `${year}-${month}-${date}`;
        },
        // 日期格式转换
        formatDate(val) {
            const text = `${val}`;
            return moment(text).format('YYYY-MM-DD');
        },
        // 卡号末四位自动补0
        formatCardend(val) {
            return val.toString().padStart(4, '0');
        },
        // 获取日期时间转换
        getFormatDate(time, date, date1) {
            // let res = "";
            // if (time && date) {
            //   res = `${moment(`${date}`).format("YYYY-MM-DD")} ${myMoment(
            //     time
            //   ).format("HH:mm:ss")}`;
            // } else if (date) {
            //   res = `${moment(`${date}`).format("YYYY-MM-DD")}`;
            // }
            // return res;
            let res = '';
            let str = '';
            let tmp = '';
            const timeStr = time.toString().trim();
            if (date !== 0) {
                tmp = `00000000${timeStr}`;
                tmp = tmp.substring(tmp.length - 8, tmp.length);
                str = tmp.substring(0, 2).concat(':').concat(tmp.substring(2, 4)).concat(':')
                    .concat(tmp.substring(4, 6));
            }
            let Str = '';
            if (date) {
                const dateStr = date.toString().trim();
                const month1 = Number(date1.substring(0, 2));
                const month2 = Number(dateStr.substring(4, 6));
                if (month1 - month2 === 11) {
                    const year = `${Number(dateStr.substring(0, 4)) - 1}`;
                    Str = year.concat('-').concat(date1.substring(0, 2)).concat('-').concat(date1.substring(2, 4));
                } else {
                    Str = dateStr.substring(0, 4).concat('-').concat(date1.substring(0, 2)).concat('-')
                        .concat(date1.substring(2, 4));
                }

                res = `${Str} ${str}`;
            }
            return res;
        },
        formateDate(val) {
            let text = '';
            if (val === '99999999') {
                text = '见单即付';
                return text;
            }
            return moment(val).format('YYYY-MM-DD');
        },
        TRANTYPDate(val) {
            this.TRANTYPEList.forEach((item) => {
                if ((`${val}`).trim() == i.code) {
                    return val + i.label;
                }
            });
            return val;
        },
        getFeeAMT(PENTLY, OTHERFEE, CASHADFEE, CARDFEE) {
            let totalfeeamt = '';
            // console.log("PENTLY:" + PENTLY + ",OTHERFEE:" + OTHERFEE + ",CASHADFEE:" + CASHADFEE + ",CARDFEE:" + CARDFEE);
            totalfeeamt = parseFloat(PENTLY) + parseFloat(OTHERFEE) + parseFloat(CASHADFEE) + parseFloat(CARDFEE);
            totalfeeamt = totalfeeamt.toFixed(2);
            return totalfeeamt;
        },
        //格式化交易金额，加上交易金额符号，精确小数点后2位小数
        formatAmount(amt, flag) {
            if (flag === '-') {
                amt = parseFloat(-1 * amt).toFixed(2);
            } else {
                amt = parseFloat(1.00 * amt).toFixed(2);
            }
            return amt;
        },
        //格式化授权码，包含“退货”、“冲正”、“提前还款”，加上链接
        formatAuthcode(authcode, desc, cardend) {


            var linkstr = '';
            if (authcode != '') {
                if (desc.indexOf("退货") != -1 || desc.indexOf("冲正") != -1 || desc.indexOf("提前还款") != -1) {

                    linkstr = `<a herf="authqry(${authcode},${cardend})">` + authcode + '</a>';
                    // linkstr = '<a herf="authqry(authcode,cardend)">' + authcode + '</a>'
                }
            }


            return linkstr;
        },
        filterDesc(val, val1, val2) {
            var linkstr = '';
            console.log("val1:", val1);
            if (val1.indexOf("服务费用") === -1) {
                linkstr = `<a herf="nfjm()">` + val1 + ' ' + val2 + '</a>';
            }
            return linkstr;
        },

    },
    components: {
        cardComponent,
    },
};
</script>
<style  lang="scss">
.billChecked {
    .textareaStyle textarea {
        color: #50658e;
        font-size: 14px;
    }
    .el-form-item__content .width100 {
        width: 100%;
    }
    .lodingStyle {
        height: auto;
    }
}
</style>
<style lang="scss" scoped>
.billChecked {
    .business_table {
        width: 95%;
        margin: 0 auto;
    }
}
.clearfix {
    text-align: center;
    background: #f5f7fa;
    padding: 5px;
}
/deep/.el-card__header {
    padding: 0 !important;
}
.footer .el-button {
    margin-top: 16px;
}
.footer {
    text-align: center;
    .pageInfo {
        margin-left: 20px;
        font-size: 14px;
    }
}
.arrearsQueryMain .el-row .el-col {
    margin-top: -5px;
    margin-bottom: -5px;
}
.queryMainLeft {
    font-size: 14px;
}
.tab-header span {
    font-size: 18px;
}
.has-gutter th {
    column-span: 7 !important;
}
.tableTitle {
    width: 100%;
    height: 30px;
    border-bottom: none;
    line-height: 30px;
    color: #000;
}
.pagination {
    margin-top: 20px;
    text-align: right;
}
.foote {
    text-align: center;
    margin-bottom: 20px;
}
</style>
